home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
program
/
ddj0897.zip
/
DYN401.ZIP
/
class
/
strdict.d
< prev
next >
Wrap
Text File
|
1996-04-01
|
2KB
|
100 lines
/*
*
* Copyright (c) 1993-1996 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37067
*
* ALL RIGHTS RESERVED.
*
*
*
*/
defclass StringDictionary : Set {
init: init_class;
};
#include "set1.h"
#define LTYPE 2 /* lookup type */
static gLookup_t Lookup; /* locally cached */
imeth gAddStr, <vAdd> (char *key, value)
{
ChkArgNul(value, 3);
return Lookup(self, (object) key, HT_ADD, 0, LTYPE, value);
}
imeth gFindValueStr, <vFindValue> (char *key)
{
object x = Lookup(self, (object) key, HT_FIND, 0, LTYPE, NULL);
return x ? gValue(x) : x;
}
imeth gFindStr, <vFind> (char *key)
{
return Lookup(self, (object) key, HT_FIND, 0, LTYPE, NULL);
}
imeth gChangeValueWithStr, <vChangeValue> (char *key, object val)
{
object x;
ChkArgNul(val, 3);
x = Lookup(self, (object) key, HT_FIND, 0, LTYPE, NULL);
return x ? gChangeValue(x, val) : x;
}
imeth gFindAddStr, <vFindAdd> (char *key, object value)
{
ChkArgNul(value, 3);
return Lookup(self, (object) key, HT_FINDADD, 0, LTYPE, value);
}
imeth object gDispose()
{
return gDispose1(self);
}
imeth object gDisposeAllNodes()
{
return gDisposeAllNodes1(self);
}
imeth gRemoveStr, <vRemove> (char *key)
{
return Lookup(self, (object) key, HT_DELETE, 1, LTYPE, NULL);
}
imeth gDeepDisposeStr, gDisposeStr (char *key)
{
return Lookup(self, (object) key, HT_DELETE, 2, LTYPE, NULL);
}
static void init_class(void)
{
Lookup = imcPointer(Set, gLookup);
}
/*
*
* Copyright (c) 1993-1996 Algorithms Corporation
* 3020 Liberty Hills Drive
* Franklin, TN 37067
*
* ALL RIGHTS RESERVED.
*
*
*
*/